package selfStudy.demo2.iotest;

import selfStudy.demo2.iotest.domain.Student1;

import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

public class Test7 {
    public static void main(String[] args) throws IOException {
        //		请编写main()方法，定义一个字符缓冲输入流BufferedReader对象，读取”test3_4.txt”文件，一次读取一行，将每行数据封装为一个Student对象，并将Student对象存储到一个集合。遍历并打印集合的所有Student信息。
        //		//定义一个BufferedReader对象
        //		BufferedReader in = new BufferedReader(......);
        //		//定义一个集合
        //		List<Student> stuList = new ArrayList<>();
        //		//一次读取一行
        //		......

        BufferedReader br = new BufferedReader(new FileReader("day12\\test3_4.txt"));

        List<Student1> list = new ArrayList<>();
        String s;
        while ((s = br.readLine()) != null) {
            String[] split = s.split(",");
            list.add(new Student1(split[0], split[1], split[2], split[3]));
        }
        for (Student1 student1 : list) {
            System.out.println(student1.toString());
        }
    }
}
